<?php
session_start();
      if (isset($_SESSION['k_username'])) {
?>
<html>
<head>
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
<style type="text/css">
<!--
.Estilo1 {font-size: 24px}
-->
</style>
<title >Tipo Socio</title>
<link rel="stylesheet" type="text/css" media="all" href="../../calendario/calendar-green.css" title="win2k-cold-1" /> 
 <!-- librería principal del calendario -->
 <script type="text/javascript" src="../../calendario/calendar.js"></script>

 <!-- librería para cargar el lenguaje deseado -->
  <script type="text/javascript" src="../../calendario/lang/calendar-es.js"></script>

  <!-- librería que declara la función Calendar.setup, que ayuda a generar un calendario en unas pocas líneas de código -->
  <script type="text/javascript" src="../../calendario/calendar-setup.js"></script>    
  <script type="text/javascript" src="../../js/funciones.js"></script>    

</head>
<body>
<?php 

  include('../../conexion.inc.php');
  $link = Conectarse();

mysql_select_db("gotica_sociosgotica",$link);
$valor=$_POST['idsocio'];
if (isset($valor)){
	$valor=$valor;
	}else{
		$valor=$_GET[valor];
		}

?>
<div align="center" class="Estilo1">Tipo Socio</div>
<?
$sqll="SELECT * FROM socio_tiposocio WHERE idsocio=".$valor;
$resultl = mysql_query($sqll, $link);

?>

<table>

<?
$i=0;
while($rowl= mysql_fetch_array($resultl)){
$i++;
$sql2="SELECT * FROM tiposocio WHERE idTipoSocio=".$rowl['idtiposocio'];
$result2 = mysql_query($sql2, $link);
$row2= mysql_fetch_array($result2);
echo "<form method=\"post\" action=\"edittsocio.php\"> ";
echo "<input type=\"hidden\" value=\"$valor\" name=\"idsocio\" />";
echo "<input type=\"hidden\" value=\"".$rowl['idtiposocio']."\" name=\"idtiposocio\" />";
echo "<tr>";
echo "<td><a href=\"deltsocio.php?idsocio=$valor&idtiposocio=$rowl[idtiposocio]\" >Eliminar </a></td> ";
echo "<td>";
echo $row2['TipoSocio']."</td>";
echo "<td>Codigo";
echo "<input name=\"codigo\" value=\"".$rowl['codigo']."\" maxlength=\"10\" size=\"10\" /></td>";
echo "<td>Ingreso<input name=\"fechingr\" id=\"fechaingreso$i\" type=\"text\" value=\"".$rowl['FechaIngreso']."\" maxlength=\"10\" size=\"10\" /><input type=\"button\"  value=\"...\" onclick=\"return showCalendar('fechaingreso$i', '%Y-%m-%d' , '24', true);\" /></td>  ";

$sql3 = "SELECT * FROM clase";


$result3 = mysql_query($sql3, $link);
echo "<td>Clase</td>";
echo "<td><select name=\"clase\" />";

while ($row3 = mysql_fetch_array($result3))
{
if ($row3['IdClase']==$rowl['IdClase']){
echo "<option selected value=\"".$row3['IdClase']."\">";
echo $row3['Clase'];
echo "</option>";}
else{
echo "<option  value=\"".$row3['IdClase']."\">";
echo $row3['Clase'];
echo "</option>";
}
}
echo "</select></td>";


$sql26 = "SELECT * FROM moneda";
$result26 = mysql_query($sql26, $link);
echo "<td>Pago<select name=\"moneda\" >";

while ($row26 = mysql_fetch_array($result26))
{
	if ($row26['idmoneda']==$rowl['idmoneda']){
echo "<option selected value=\"".$row26['idmoneda']."\">";
echo $row26['tagmon'];
echo "</option>";} else
{
	echo "<option value=\"".$row26['idmoneda']."\">";
echo $row26['tagmon'];
echo "</option>";
	}
}
echo "</select><input name=\"pago\" value=\"$rowl[pago]\"  type=\"text\" maxlength=\"10\" size=\"10\" />";

echo "</td>";
echo "<td><input type=\"submit\" name=\"envia\" value=\"Editar\" /></td>";

echo "</tr>";
echo "</form>";}
?>


</table>

<form method="post" action="addtsocio.php"> 
<table>
<tr>
<?
echo "<td>";
$sql22="SELECT * FROM tiposocio";
$result22 = mysql_query($sql22, $link);
echo "<select name=\"tiposocio\" >";
while ($row22 = mysql_fetch_array($result22)){
echo "<option  value=\"".$row22['idTipoSocio']."\">";
echo $row22['TipoSocio'];
echo "</option>";}
echo "</td>";
echo "<input type=\"hidden\" value=".$valor." name=\"idsocio\" />";
echo "<td><input type=\"submit\" value=\"Agregar\" name=\"agregar\" /> </td>"
?>

</tr>
</table>
</form> <?
echo "<form method=\"post\" action=\"edicionsocio.php\">";
echo "<input type=\"hidden\" value=".$valor." name=\"valor\" />";
echo "<input type=\"submit\"  class=\"buttonmi\" name=\"edit\" value=\"Atras\" />";
echo "</form>"; ?>
</body>
</html>
<?
}else
{
	echo "<SCRIPT LANGUAGE=\"javascript\">";
echo "location.href = \"index.php\"";
echo "</SCRIPT>";
	}
?>
